Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 4 - Colors and Color-Related Objects / Colors and Color-Related Objects Reference
Color Set Functions / Creating and Manipulating Color Set Objects


GXNewColorSet

You can use the GXNewColorSet function to create a new color set object.

gxColorSet GXNewColorSet(gxColorSpace space, long count, 
                        const gxSetColor colors[]);
space
The color space of the color set. You may not specify gxIndexedSpace for this parameter.
count
The size of the color space; the number of color values it contains.
colors
The array of color values that make up the color set.
function result
A reference to the newly created color set object.
DESCRIPTION
The GXNewColorSet function creates a color set object with an owner count of 1 and returns a reference to it as the function result. You specify the number of colors in the color set in the count parameter, and pass the colors to the function in the colors array. Note that the array must contain color values of type gxSetColor.

You do not use this function to obtain a copy of a default color set; the colors
array must contain one or more elements. If it does not, GXNewColorSet posts a color_is_nil error. If you specify gxIndexedSpace for the space parameter,
this function posts a colorSpace_out_of_range error.

SPECIAL CONSIDERATIONS
If no error occurs, the GXNewColorSet function creates a color set object; you are responsible for disposing of that object when you no longer need it.

The current implementation of QuickDraw GX restricts the number of colors in a color set to a maximum of 65,535.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
color_is_nil
count_is_less_than_zero(debugging version)
colorSpace_out_of_range(debugging version)
number_of_colors_exceeds_implementation_limit
SEE ALSO
The gxSetColor union is described on page 4-56.

To obtain a copy of a default color set object, use the GXGetDefaultColorSet function, described on page 4-62.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996